package com.sljy.hzk.room.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.sljy.hzk.entity.TaskDatabaseEntity;
import com.sljy.hzk.entity.UserEntity;

import java.util.List;

/**
 * Created  on 2018/7/10 0010
 *
 * @author 唐开阔
 * @describe
 */
@Dao
public interface TaskDao {
    /**
     * 添加一个数据
     */
    @Insert
    void insert(TaskDatabaseEntity userEntity);

    @Update
    void update(TaskDatabaseEntity userEntity);

    @Delete
    void delete(TaskDatabaseEntity userEntity);

    @Query("SELECT  dataJson FROM TaskDatabaseEntity where workPlanId = :id")
    String get(int id);

    @Query("SELECT  * FROM TaskDatabaseEntity where workPlanId = :workPlanId")
    TaskDatabaseEntity getWork(int workPlanId);


    @Query("SELECT  * FROM TaskDatabaseEntity")
    List<TaskDatabaseEntity> getAll();

    @Query("SELECT  * FROM TaskDatabaseEntity where userId = :id")
    List<TaskDatabaseEntity> getUserAll(long id);

}
